<template>
    <div>
        <div>
            <input type="text" v-model='a'>
            <button @click="add">添加</button>
        </div>
    </div>
</template>

<script lang="ts">
interface obType {
    flag: boolean,
    txt: string|undefined,
    isEdit: boolean
}
import { ref } from 'vue'
export default {
    props: {
        word: String
    },
    setup(options,{emit}) {
        let a = ref(options.word)
        let add = () => {
            let obj: obType = {
                txt: a.value,
                flag: false,
                isEdit: false
            }
            emit('add',obj)
        }



        return {
            a,
            add
        }
    }
}
</script>